package com.bite.order.controller;


import com.bite.order.api.ProductApi;
import com.bite.product.model.ProductInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试远程调用-参数传递
 */
@RestController
@RequestMapping("/feign")
public class FeignController {

    @Autowired
    private ProductApi productApi;

    @RequestMapping("/basicInvoke")
    public String basicInvoke(Integer id, String name) {
        return productApi.basicType(id, name);
    }

    @RequestMapping("/objectInvoke")
    public String objectInvoke() {
        ProductInfo productInfo = new ProductInfo();
        productInfo.setId(1);
        productInfo.setProductName("测试");
        productInfo.setProductPrice(100);
        return productApi.objectType(productInfo);
    }


    @RequestMapping("/jsonInvoke")
    public String jsonInvoke() {
        ProductInfo productInfo = new ProductInfo();
        productInfo.setId(1);
        productInfo.setProductName("测试");
        productInfo.setProductPrice(100);
        return productApi.jsonType(productInfo);
    }
}
